package com.situ.mall.controller.front;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

import com.situ.mall.common.ServerResponse;
import com.situ.mall.entity.Shipping;
import com.situ.mall.entity.User;
import com.situ.mall.service.IShippingService;

@Controller
@RequestMapping("/shipping")
public class FontShippingController {

	@Autowired
	private IShippingService shippingService;
	
	@RequestMapping("/getUserCenterSite.shtml")
	public String getUserCenterSite(HttpSession session,Model model) {
		User user = (User) session.getAttribute("user");
		Shipping shipping = shippingService.selectShippingByUserId(user.getId());
		model.addAttribute("shipping", shipping);
		return "user_center_site";
	}
	
	@RequestMapping("/editShippingSite.shtml")
	public ServerResponse editShippingSite(HttpSession session,HttpServletRequest req) {
		User user = (User) session.getAttribute("user");
		
		String receiver = req.getParameter("receiver");
		String detailAdd = req.getParameter("detailAdd");
		String zip = req.getParameter("zip");
		String phone = req.getParameter("phone");
		
		Shipping shipping = shippingService.selectShippingByUserId(user.getId());
		if (shipping == null) {
			
		}
		return null;
		
	}
}
